<template>
  <div class="product-status">
    <div :class="[types==='list'?'list-status':'detail-status']">
      <template v-if="datas.productStatus==='2'">
        <div style="margin:0px 3px;">{{ getLabel('product_status',datas.productStatus) }}</div>
        <div
          v-if="datas.flowStatus==='DOING'"
          :class="[types==='list'?'flow-status-color':'']"
        >
          <span v-if="datas.processDefinitionKey==='productDown'">[下架审核中]</span>
          <span v-if="datas.processDefinitionKey==='productUpdate'">[变更审核中]</span>
        </div>
      </template>
      <template v-else-if="datas.productStatus==='1'">
        <div style="margin:0px 3px;">{{ getLabel('product_status',datas.productStatus) }}</div>
        <template v-if="datas.flowStatus==='REJECT_INITIATOR'">
          <div class="flow-status-color">[驳回]</div>
        </template>
      </template>
      <template v-else>
        <span>{{ getLabel('product_status',datas.productStatus) }}</span>
      </template>
    </div>
  </div>
</template>

<script>
import { defineComponent, toRefs } from 'vue'

export default defineComponent({
  props: {
    datas: {
      type: Object,
      default: () => {
        return {
          productStatus: -1,
          flowStatus: '',
        }
      },
    },
    types: {
      type: String,
      default: 'list',
    },
  },
  setup(props, context) {
    return {
      ...toRefs(props),
    }
  },
})
</script>

<style lang="sass" scoped>
.product-status
  .detail-status
    display: flex
    justify-content: flex-start
    align-items: center
</style>

